import React, { PureComponent } from 'react'

export class App extends PureComponent {
  constructor() {
    super()
    this.state = {
      inputValue: ''
    }
  }
  changeInput(e) {
    this.setState({ inputValue: e.target.value })
  }
  render() {
    const { inputValue } = this.state
    return (
      <div>
        {/* 受控组件 */}
        <input type="text" value={inputValue} onChange={e => this.changeInput(e)} />

        {/* 非受控组件 */}
        <input type="text" />
        <h3>inputValue: { inputValue }</h3>
      </div>
    )
  }
}

export default App